package qc.module.ehs.api.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import qc.common.core.exception.QCPromptException;
import qc.module.ehs.dto.staffsignin.StaffSignInDto;
import qc.module.ehs.dto.staffsignin.StaffSignInQueryConditionDto;
import qc.module.ehs.service.EhsStaffSignInRecordService;

import java.util.List;

/**
 * StaffSignInController
 *
 * @author QuCheng Tech
 * @since 2025/6/24
 */
@RestController
@RequestMapping("/staffsignin")
public class StaffSignInController {

    @Autowired
    private EhsStaffSignInRecordService service;

    /**
     * 查询最新签到记录
     * 查询指定条件内每个人员最新的签到记录；一个人员返回最新一条签到记录，如果查询条件内人员没有签到记录不返回该人员记录；
     *
     * @param condition 查询条件
     * @return java.util.List<qc.module.ehs.dto.staffsignin.StaffSignInDto>
     * @author QuCheng Tech
     * @since 2025/6/24
     */
    @RequestMapping(value = "/latest", method = {RequestMethod.GET, RequestMethod.POST})
    public List<StaffSignInDto> queryLatest(@RequestBody StaffSignInQueryConditionDto condition) throws QCPromptException {
        return service.queryLatest(condition);
    }
}
